package day06_exception_collection.com.itheima.d1_exception;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo1_Exception {
    public static void main(String[] args) throws ParseException {
        System.out.println("start");

        int[] arr = {11, 22, 33};
        System.out.println("arr[0] = " + arr[0]);
        System.out.println("arr[1] = " + arr[1]);
        System.out.println("arr[2] = " + arr[2]);

        String name = null;
//        System.out.println("name.length() = " + name.length());

//        System.out.println("(10 / 0) = " + (10 / 0));

        Object o = "张麻子";
//        Integer i = (Integer) o;

        String s = "23a";
//        int it = Integer.valueOf(s);
//        System.out.println("it = " + it);

        parseDate("2024-03-19 13:20:31");


        System.out.println("end");
    }
    public static void parseDate(String date) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date d = sdf.parse(date);
        System.out.println(d);

    }
}
